<template>
    <div class="tabWrap">
        <van-tabbar
            v-model="activeS"
            active-color="#627DF1"
            @change="changeTabBar"
        >
            <van-tabbar-item :info="info" to="/message">
                <span class="tabBarTxt">消息</span>
                <img
                    slot="icon"
                    slot-scope="props"
                    :src="props.active?icon.active:icon.normal"
                >
            </van-tabbar-item>
            <van-tabbar-item to="/index_AddressBook">
                <span class="tabBarTxt">通讯录</span>
                <img
                    slot="icon"
                    slot-scope="props"
                    :src="props.active?icon1.active:icon1.normal"
                >
            </van-tabbar-item>
            <van-tabbar-item to="/index_My">
                <span class="tabBarTxt">我</span>
                <img
                    slot="icon"
                    slot-scope="props"
                    :src="props.active?icon2.active:icon2.normal"
                >
            </van-tabbar-item>
        </van-tabbar>
    </div>
</template>

<script>
    import {Tabbar, TabbarItem} from 'vant';
    import IMessage from "../assets/img/messageIcon.png"
    import IMessageA from "../assets/img/messageIconA.png"
    import IAddress from "../assets/img/addressIcon.png"
    import IAddressA from "../assets/img/addressIconA.png"
    import IMy from "../assets/img/myIcon.png"
    import IMyA from "../assets/img/myIconA.png"

    export default {
        data() {
            return {
                icon: {
                    normal: IMessage,
                    active: IMessageA
                },
                icon1: {
                    normal: IAddress,
                    active: IAddressA
                },
                icon2: {
                    normal: IMy,
                    active: IMyA
                },
                activeS: this.active
            }
        },
        components: {
            [Tabbar.name]: Tabbar,
            [TabbarItem.name]: TabbarItem
        },
        methods: {
            changeTabBar(active) {
                this.activeS = active;
            }
        },
        props: ["active", "info"],
        activated() {
            this.activeS = this.active
        }

    }
</script>

<style scoped lang="less">
    .tabWrap {
        position: fixed;
        width: 100%;
        height: 98px;
        left: 0;
        bottom: 0;
        z-index: 99;
        background-color: #fbf8f5;

        .van-tabbar {
            background-color: #fbf8f5;

            .tabBarTxt {
                font-family: PingFangSC-Medium;
                font-weight: 400;
                font-size: 22px;
            }
        }


    }
</style>
